package com.ruoyi.web.controller.procurement;

import java.io.*;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.procurement.domain.PsGoods;
import com.ruoyi.procurement.domain.PsGoodsType;
import com.ruoyi.procurement.domain.PsUnit;
import com.ruoyi.procurement.domain.doc.PsOutboundDoc;
import com.ruoyi.procurement.domain.doc.PsOutboundMonthDoc;
import com.ruoyi.procurement.domain.doc.PsOutboundTotalDoc;
import com.ruoyi.procurement.domain.vo.PsOutboundVo;
import com.ruoyi.procurement.service.IPsGoodsService;
import com.ruoyi.procurement.service.IPsGoodsTypeService;
import com.ruoyi.procurement.service.IPsUnitService;
import com.ruoyi.system.service.ISysDictDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.procurement.domain.PsOutbound;
import com.ruoyi.procurement.service.IPsOutboundService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 物品出库Controller
 * 
 * @author ruoyi
 * @date 2023-10-10
 */
@Api(value = "物品出库")
@RestController
@RequestMapping("/procurement-system/outbound")
public class PsOutboundController extends BaseController
{
    @Autowired
    private IPsOutboundService psOutboundService;
    @Autowired
    private IPsUnitService iPsUnitService;
    @Autowired
    private IPsGoodsService iPsGoodsService;
    @Autowired
    private ISysDictDataService iSysDictDataService;
    @Autowired
    private IPsGoodsTypeService iPsGoodsTypeService;
    @Value("${ruoyi.profile}")
    private String filePath;

    /**
     * 查询物品出库列表
     */
    @ApiOperation("查询物品出库列表")
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:list')")
    @GetMapping("/list")
    public TableDataInfo list(PsOutbound psOutbound)
    {
        startPage();
        List<PsOutboundVo> list = psOutboundService.selectPsOutboundList(psOutbound,"desc");
        return getDataTable(list);
    }

    /**
     * 导出物品出库总表
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:export')")
    @Log(title = "导出物品出库总表", businessType = BusinessType.EXPORT)
    @PostMapping("/export2")
    public void export2(HttpServletResponse response, PsOutbound psOutbound) throws IOException {
        LinkedHashMap<String, List<PsOutboundTotalDoc>> stringPsOutboundTotalDocLinkedHashMap = new LinkedHashMap<>();
        List<PsOutboundVo > list = psOutboundService.selectPsOutboundList(psOutbound,"asc");
        if (CollUtil.isEmpty(list)){
            throw new ServiceException("数据不足！");
        }
        //key 物品类别
        LinkedHashMap<String,List<PsOutbound>> mapp = new LinkedHashMap<>();
        for (PsOutbound outbound : list) {
            List<PsOutbound> psOutbounds = mapp.get(outbound.getGoodsType());
            if (CollUtil.isNotEmpty(psOutbounds)){
                psOutbounds.add(outbound);
            }else {
                psOutbounds = new ArrayList<>();
                psOutbounds.add(outbound);
            }
            mapp.put(outbound.getGoodsType(),psOutbounds);
        }

        for (Map.Entry<String, List<PsOutbound>> stringListEntry : mapp.entrySet()) {
            //物品类别
            String key = stringListEntry.getKey();
            List<PsOutbound> value = stringListEntry.getValue();
            //key 物品id
            LinkedHashMap<String, List<PsOutbound>> map = new LinkedHashMap<>();
            for (PsOutbound outbound : value) {
                Date createTime = outbound.getPoDeliveryDate();
//            String string = DateUtil.date(createTime).toString(Constants.DATE_FORMAT_rule3);
                List<PsOutbound> psOutbounds = map.get(outbound.getPsGoodsId());
                if (CollUtil.isNotEmpty(psOutbounds)){
                    psOutbounds.add(outbound);
                }else {
                    psOutbounds = new ArrayList<>();
                    psOutbounds.add(outbound);
                }
                map.put(outbound.getPsGoodsId(),psOutbounds);
            }
            List<PsOutboundTotalDoc> psOutboundTotalDocs = new ArrayList<>();

            for (Map.Entry<String, List<PsOutbound>> stringListEntry2 : map.entrySet()) {
                //规格
                String pstSpecification = "";
                //物品id
                String key0 = stringListEntry2.getKey();
                List<PsOutbound> value0 = stringListEntry2.getValue();
                if (CollUtil.isNotEmpty(value0)) {
                    PsOutbound psOutbound1 = value0.get(0);
                    if (psOutbound1!=null) {
                        if (StringUtils.isNotEmpty(psOutbound1.getPstSpecification())){
                            pstSpecification = psOutbound1.getPstSpecification();
                        }else {
                            String typeId = psOutbound1.getGoodsTypeId();
                            if (StringUtils.isNotEmpty(typeId)){
                                PsGoodsType psGoodsType = iPsGoodsTypeService.selectPsGoodsTypeById(typeId);
                                if (psGoodsType!=null){
                                    if (StringUtils.isNotEmpty(psGoodsType.getPstSpecification())) {
                                        pstSpecification = psGoodsType.getPstSpecification();
                                    }
                                }
                            }
                        }
                    }
                }
                //key 年月
                LinkedHashMap<String,List<PsOutbound>> ma = new LinkedHashMap<>();

                for (PsOutbound outbound : value0) {
                    Date createTime = outbound.getPoDeliveryDate();
                    String dateF = DateUtil.date(createTime).toString(Constants.DATE_FORMAT_rule4);
                    List<PsOutbound> psOutbounds = ma.get(dateF);
                    if (CollUtil.isNotEmpty(psOutbounds)){
                        psOutbounds.add(outbound);
                    }else {
                        psOutbounds = new ArrayList<>();
                        psOutbounds.add(outbound);
                    }
                    ma.put(dateF,psOutbounds);
                }
                int i = 0;
                //月 里面的天数
                for (Map.Entry<String, List<PsOutbound>> listEntry : ma.entrySet()) {
                    i++;
                    String key1 = listEntry.getKey();
                    List<PsOutbound> value1 = listEntry.getValue();
                    PsOutboundTotalDoc psOutboundTotalDoc = new PsOutboundTotalDoc();
                    psOutboundTotalDoc.setPstSpecification(pstSpecification);
                    PsGoods psGoods = iPsGoodsService.selectPsGoodsByGoodsId(key0);
                    psOutboundTotalDoc.setGoodsName(psGoods.getGoodsName());
                    psOutboundTotalDoc.setCode(i+"");
                    String goodsUnit = psGoods.getGoodsUnit();
                    if (StringUtils.isNotEmpty(goodsUnit)){
                        //查询单位
                        SysDictData sysDictData = new SysDictData();
                        sysDictData.setDictType("ps_goods_unit");
                        List<SysDictData> sysDictData1 = iSysDictDataService.selectDictDataList(sysDictData);
                        Map<String, SysDictData> collect = sysDictData1.stream().collect(Collectors.toMap(k -> k.getDictValue(), v -> v));
                        SysDictData sysDictData2 = collect.get(goodsUnit);
                        psOutboundTotalDoc.setPoUnit(sysDictData2.getDictLabel());
                    }else {
                        psOutboundTotalDoc.setPoUnit("未知");
                    }
                    psOutboundTotalDoc.setTime(key1);

                    //计算总量
                    BigDecimal sumTotal = new BigDecimal("0.0");
                    //计算总金额
                    BigDecimal sumTotalParce = new BigDecimal("0.0");
                    for (PsOutbound outbound : value1) {
                        Date createTime = outbound.getPoDeliveryDate();
                        sumTotal = sumTotal.add(outbound.getPoNum());
                        sumTotalParce = sumTotalParce.add(outbound.getPoAmount());
                        int field = DateUtil.date(createTime).getField(DateField.DAY_OF_MONTH);
                        Class<? extends PsOutboundTotalDoc> aClass = psOutboundTotalDoc.getClass();
                        try {
                            Field declaredField = aClass.getDeclaredField("day" + field);
                            declaredField.setAccessible(true);
                            Object o = declaredField.get(psOutboundTotalDoc);
                            if (o!=null){
                                BigDecimal nu = (BigDecimal) o;
                                nu = nu.add(outbound.getPoNum());
                                declaredField.set(psOutboundTotalDoc,nu);
                            }else {
                                declaredField.set(psOutboundTotalDoc,outbound.getPoNum());
                            }

                        } catch (NoSuchFieldException e) {
                            throw new RuntimeException(e);
                        } catch (IllegalAccessException e) {
                            throw new RuntimeException(e);
                        }
                    }
//                    psOutboundTotalDoc.setPoPrice(psOutboundTotalDoc.getPoPrice());
                    psOutboundTotalDoc.setDay32(sumTotal);
                    psOutboundTotalDoc.setDay33(sumTotalParce);
                    psOutboundTotalDocs.add(psOutboundTotalDoc);
                }

            stringPsOutboundTotalDocLinkedHashMap.put(key,psOutboundTotalDocs);
            }
        }

        File template = new File(filePath+"total-hen.xlsx");
        XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(template));
//        ps_goods_type
        SysDictData sysDictData = new SysDictData();
        sysDictData.setDictType("ps_goods_type");
        List<SysDictData> sysDictData1 = iSysDictDataService.selectDictDataList(sysDictData);
        Map<String, SysDictData> collect = sysDictData1.stream().collect(Collectors.toMap(k -> k.getDictValue(), v -> v));
//        workbook.setSheetName(0,);
        int si = 0;
        LinkedHashMap<String, List<PsOutboundTotalDoc>> stringListHashMap = new LinkedHashMap<>();
        List<PsOutboundTotalDoc> meat = stringPsOutboundTotalDocLinkedHashMap.get("meat");
        if (CollUtil.isNotEmpty(meat)) {
            stringListHashMap.put("meat",meat);
            stringPsOutboundTotalDocLinkedHashMap.remove("meat");
        }
        List<PsOutboundTotalDoc> vegetable = stringPsOutboundTotalDocLinkedHashMap.get("vegetable");
        if (CollUtil.isNotEmpty(vegetable)) {
            stringListHashMap.put("vegetable",vegetable);
            stringPsOutboundTotalDocLinkedHashMap.remove("vegetable");
        }
        List<PsOutboundTotalDoc> non_staple_food = stringPsOutboundTotalDocLinkedHashMap.get("non_staple_food");
        if (CollUtil.isNotEmpty(non_staple_food)) {
            stringListHashMap.put("non_staple_food",non_staple_food);
            stringPsOutboundTotalDocLinkedHashMap.remove("non_staple_food");
        }
        List<PsOutboundTotalDoc> fruit = stringPsOutboundTotalDocLinkedHashMap.get("fruit");
        if (CollUtil.isNotEmpty(fruit)) {
            stringListHashMap.put("fruit",fruit);
            stringPsOutboundTotalDocLinkedHashMap.remove("fruit");
        }
        stringListHashMap.putAll(stringPsOutboundTotalDocLinkedHashMap);

        for (String s : stringListHashMap.keySet()) {
            SysDictData sysDictData2 = collect.get(s);
            String name = "未知";
            if (sysDictData2!=null) {
                name = sysDictData2.getDictLabel();
            }
            if (si==0){
                workbook.setSheetName(0,name);
                si++;
            }else {
                workbook.cloneSheet(0,name);
            }


        }
        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        response.setCharacterEncoding("utf-8");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        workbook.write(outputStream);
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(outputStream.toByteArray());
        try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(byteArrayInputStream).build()) {

            FillConfig fillConfig2 = FillConfig.builder().forceNewRow(true).build();
            int i = 0;

            for (Map.Entry<String, List<PsOutboundTotalDoc>> stringListEntry : stringListHashMap.entrySet()) {
                String key = stringListEntry.getKey();
                List<PsOutboundTotalDoc> value = stringListEntry.getValue();
                WriteSheet writeSheet = EasyExcel.writerSheet(i).build();
                int ii = 0;
                for (PsOutboundTotalDoc psOutboundTotalDoc : value) {
                    ii++;
                    psOutboundTotalDoc.setCode(ii+"");
                }
                //标题 TODO
                Map<String, Object> params = psOutbound.getParams();
                String time = "未选择时间";
                Object createTimeStart = params.get("createTimeStart");
                Object createTimeEnd = params.get("createTimeEnd");
                if (createTimeStart!=null && createTimeEnd!=null){
                    time = createTimeStart + " - " + createTimeEnd;
                }
                HashMap<String, String> stringStringHashMap = new HashMap<>();
                stringStringHashMap.put("time",time);
                excelWriter.fill(stringStringHashMap,  writeSheet);
                excelWriter.fill(new FillWrapper(value), fillConfig2, writeSheet);
                i++;
            }

            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            response.setCharacterEncoding("utf-8");
        }catch (Exception e){

        }
    }
    /**
     * 导出物品出库列表
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:export')")
    @Log(title = "物品出库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PsOutbound psOutbound)
    {
        List<PsOutboundVo> list = psOutboundService.selectPsOutboundList(psOutbound,"asc");
        if (CollUtil.isEmpty(list)){
            throw new ServiceException("数据不足！");
        }
//        ExcelUtil<PsOutbound> util = new ExcelUtil<PsOutbound>(PsOutbound.class);
//        util.exportExcel(response, list, "物品出库数据");

        //出库单位
        Map<String, Object> params = psOutbound.getParams();
        String unitName = "";
        Object psUnitId = params.get("psUnitId");
        if (psUnitId!=null) {
            String s = psUnitId.toString().replace("[","").replace("]","");
            if (StringUtils.isNotEmpty(s)){
                ArrayList<String> list1 = new ArrayList<>(Arrays.asList(s.split(",")));
                HashMap<String, Object> stringObjectHashMap = new HashMap<>();
                stringObjectHashMap.put("ids",list1);
                PsUnit psUnit = new PsUnit();
                psUnit.setParams(stringObjectHashMap);
                List<PsUnit> psUnits = iPsUnitService.selectPsUnitList(psUnit);
                if (CollUtil.isNotEmpty(psUnits)){
                    unitName = psUnits.stream().map(psUnit1 -> psUnit1.getPuName()).collect(Collectors.joining(","));
                }else {
                    unitName = "未选择出库单位";
                }
            }
        }else {
            unitName = "未选择出库单位";
        }
        File template = new File(filePath+"out_day.xlsx");
//        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(template).build()) {

            WriteSheet writeSheet = EasyExcel.writerSheet(0).build();
            FillConfig fillConfig2 = FillConfig.builder().forceNewRow(true).build();

            Map<String, Object> map = new HashMap<>();
            List<PsOutboundDoc> listDoc = new ArrayList<>();
            //出库单位
            map.put("psUnitId",unitName);
            map.put("createUser", SecurityUtils.getLoginUser().getUser().getNickName());
            map.put("time",DateUtil.date().toString(Constants.DATE_FORMAT_rule2));
            BigDecimal bigDecimal = new BigDecimal("0.0");
            int i = 0;
            for (PsOutbound outbound : list) {
                i++;
                String poUnit = outbound.getPoUnit();
                PsOutboundDoc psOutboundDoc = new PsOutboundDoc();
                if (StringUtils.isNotEmpty(poUnit)){
                    SysDictData sysDictData = new SysDictData();
                    sysDictData.setDictType("ps_goods_unit");
                    List<SysDictData> sysDictData1 = iSysDictDataService.selectDictDataList(sysDictData);
                    Map<String, SysDictData> collect = sysDictData1.stream().collect(Collectors.toMap(k -> k.getDictValue(), v -> v));
                    SysDictData sysDictData2 = collect.get(poUnit);
                    psOutboundDoc.setGoodsUnit(sysDictData2.getDictLabel());
                }
                psOutboundDoc.setCode(i+"");
                //单位
                psOutboundDoc.setPoNum(outbound.getPoNum());
                if (StringUtils.isNotEmpty(outbound.getPstSpecification())){
                    //规格
                    psOutboundDoc.setPstSpecification(outbound.getPstSpecification());
                }else {
                    //查询物品标准是否有规格
                    String goodsTypeId = outbound.getGoodsTypeId();
                    if (StringUtils.isNotEmpty(goodsTypeId)){
                        PsGoodsType psGoodsType = iPsGoodsTypeService.selectPsGoodsTypeById(goodsTypeId);
                        if (psGoodsType!=null){
                            if (StringUtils.isNotEmpty(psGoodsType.getPstSpecification())) {
                                psOutboundDoc.setPstSpecification(psGoodsType.getPstSpecification());
                            }
                        }
                    }
                }
                //单价
                psOutboundDoc.setPoPrice(outbound.getPoPrice());
                //小计金额
                psOutboundDoc.setPoAmount(outbound.getPoAmount());
                if (outbound.getPoAmount()!=null) {
                    bigDecimal = bigDecimal.add(outbound.getPoAmount());
                }
                //物品名称
                PsGoods psGoods = iPsGoodsService.selectPsGoodsByGoodsId(outbound.getPsGoodsId());
                psOutboundDoc.setGoodsName(psGoods.getGoodsName());
                listDoc.add(psOutboundDoc);
            }

            map.put("totalAmount",bigDecimal);


            excelWriter.fill(map, writeSheet);
            excelWriter.fill(new FillWrapper(listDoc), fillConfig2, writeSheet);

            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            response.setCharacterEncoding("utf-8");


        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 导出物品出库列表
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:export')")
    @Log(title = "物品出库", businessType = BusinessType.EXPORT)
    @PostMapping("/export3")
    public void export3(HttpServletResponse response, PsOutbound psOutbound) {
        List<PsOutboundVo> list = psOutboundService.selectPsOutboundList(psOutbound,"asc");
        if (CollUtil.isEmpty(list)){
            throw new ServiceException("数据不足！");
        }
        Map<String, Object> params = psOutbound.getParams();
        String time = "未选择时间";
        Object createTimeStart = params.get("createTimeStart");
        Object createTimeEnd = params.get("createTimeEnd");
        if (createTimeStart!=null && createTimeEnd!=null){
            time = createTimeStart + " - " + createTimeEnd;
        }
        ArrayList<PsOutboundMonthDoc> psOutboundMonthDocs = new ArrayList<PsOutboundMonthDoc>();
        Set<String> collect = list.stream().map(st -> st.getPsGoodsId()).collect(Collectors.toSet());
        int i = 0;
        for (String s : collect) {
            i++;
            PsGoods psGoods = iPsGoodsService.selectPsGoodsByGoodsId(s);
            PsOutboundMonthDoc psOutboundMonthDoc = new PsOutboundMonthDoc();
            psOutboundMonthDoc.setCode(i+"");
            psOutboundMonthDoc.setGoodsName(psGoods.getGoodsName());

            String goodsTypeId = psGoods.getGoodsTypeId();
            if (StringUtils.isNotEmpty(goodsTypeId)){
                PsGoodsType psGoodsType = iPsGoodsTypeService.selectPsGoodsTypeById(goodsTypeId);
                if (psGoodsType!=null){
                    psOutboundMonthDoc.setPstSpecification(psGoodsType.getPstSpecification());
                }
            }
            //查询单位
            SysDictData sysDictData = new SysDictData();
            sysDictData.setDictType("ps_goods_unit");
            List<SysDictData> sysDictData1 = iSysDictDataService.selectDictDataList(sysDictData);
            Map<String, SysDictData> collec2t = sysDictData1.stream().collect(Collectors.toMap(k -> k.getDictValue(), v -> v));
            SysDictData sysDictData2 = collec2t.get(psGoods.getGoodsUnit());
            String unit = "未设置";
            if (sysDictData2!=null) {
                unit = sysDictData2.getDictLabel();
            }
            psOutboundMonthDoc.setGoodsUnit(unit);
            psOutboundMonthDocs.add(psOutboundMonthDoc);
        }

        File template = new File(filePath+"zong_month.xlsx");
//        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(template).build()) {
            WriteSheet writeSheet = EasyExcel.writerSheet(0).build();
            FillConfig fillConfig2 = FillConfig.builder().forceNewRow(true).build();


            HashMap<String, String> stringStringHashMap = new HashMap<>();
            stringStringHashMap.put("time",time);

            excelWriter.fill(stringStringHashMap, writeSheet);
            excelWriter.fill(new FillWrapper(psOutboundMonthDocs), fillConfig2, writeSheet);

            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            response.setCharacterEncoding("utf-8");
        }catch (Exception e){

        }
    }

    /**
     * 获取物品出库详细信息
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(psOutboundService.selectPsOutboundById(id));
    }

    /**
     * 新增物品出库
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:add')")
    @Log(title = "物品出库", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PsOutbound psOutbound)
    {
        return toAjax(psOutboundService.insertPsOutbound(psOutbound));
    }

    /**
     * 修改物品出库
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:edit')")
    @Log(title = "物品出库", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PsOutbound psOutbound)
    {
        return toAjax(psOutboundService.updatePsOutbound(psOutbound));
    }

    /**
     * 删除物品出库
     */
    @PreAuthorize("@ss.hasPermi('procurement-system:outbound:remove')")
    @Log(title = "物品出库", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(psOutboundService.deletePsOutboundByIds(ids));
    }
}
